package com.itheima.idea;

import java.util.Scanner;
import java.util.Random;
public class Test {
    public static void main(String[] args) {
        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        int randomNum = r.nextInt(100) + 1;
        while (true) {
            System.out.println("请输入你要猜的数");
            int num = sc.nextInt();
            if (num > randomNum) {
                System.out.println("你输入的数字大了");
            } else {
                if (num < randomNum) {
                    System.out.println("你输入的数小了");
                } else {
                    System.out.println("恭喜你猜对了");
                    break;
                }

            }
        }
    }
    }



